home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14724 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: chronicle.mti.sgi.com!news
  2. From: austern@isolde.mti.sgi.com (Matt Austern)
  3. Newsgroups: comp.object,comp.lang.c++,comp.lang.java
  4. Subject: Re: Java: What's the Big Deal?
  5. Date: 01 Apr 1996 19:44:41 GMT
  6. Organization: SGI
  7. Message-ID: <AUSTERN.96Apr1114441@isolde.mti.sgi.com>
  8. References: <4jk4ee$7ri@newsbf02.news.aol.com> <1996Apr1.155416.12816@schbbs.mot.com>
  9.     <Dp757r.K5@aplcenmp.apl.jhu.edu>
  10. Reply-To: austern@mti.sgi.com
  11. NNTP-Posting-Host: isolde.mti.sgi.com
  12. In-reply-to: hall@aplcenmp.apl.jhu.edu's message of Mon, 1 Apr 1996 18:40:39 GMT
  13.  
  14. In article <Dp757r.K5@aplcenmp.apl.jhu.edu> hall@aplcenmp.apl.jhu.edu (Marty Hall) writes:
  15.  
  16. > >With Java's array, memory will be smashed into millions of small
  17. > >pieces.
  18. > There are also plenty of arguments that GC decreases the average
  19. > overall fragmentation in real programs and that allocators in GC'd
  20. > systems will be faster. Just as I don't buy the above argument as
  21. > showing anything typical, I don't buy the "GC decreases fragmentation"
  22. > argument either. Perhaps, but I'm not sure very many people know
  23. > enough about the typical memory allocation/deallocation patterns in
  24. > "real" programs to be able to tell. 
  25.  
  26. This isn't really a GC versus non-GC issue, but one that deals more
  27. narrowly with Java.  In most languages (C, C++, Ada, Eiffel, etc.),
  28. you can allocate objects that are referred to either by value or by
  29. reference.  So, for example, you can create an array of 1000 complex
  30. numbers with the reasonable expectation that you'll get a single 16000
  31. byte memory block.
  32.  
  33. Java doesn't give you that choice: every object of a user-defined type
  34. must be allocated on the heap.  If you're dealing with lots of small
  35. objects, then you will have to do lots of little heap allocations and,
  36. unless you've got an unusually clever compiler, you probably will see
  37. memory fragmentation.
  38. -- 
  39. Matt Austern
  40. SGI: MTI Compilers Group
  41. austern@isolde.mti.sgi.com
  42.